/*插件:过滤器*/

k_plugins.filter = {
	name: '插件例子：高亮',
	ui: function() {
		return '<div>哪些词语高亮？每行写一个。</div><textarea id="textareafilter" class="border1"></textarea>';
	},
	init: function() {
		$('#textareafilter').val(getCookie('textareafilter'));
		$('#textareafilter').blur(function() {
			setCookie('textareafilter', $('#textareafilter').val(), 1000);
		});
	},
	filter: function(msg, type) {
		if (type == 'home') {
			var xxx = getCookie('textareafilter').split("\n");
			if (!xxx.length) return true;
			$.each(xxx, function() {
				var ttt = $.trim(this);
				if (ttt.length) {
					msg.processedtext = msg.processedtext.replace(ttt, '<font color="red">' + ttt + '</font>');
				}
			});
		}
		return true;
	}
};

/*插件：预览img.ly, twitpic, twitgoo图片*/
k_plugins.imglypreview = {
	name:'插件例子:img.ly图片预览插件',
	ui: function(){
		return '说明:显示img.ly大图.<br />正在工作...';
	},
	init: function(){

	},
	filter: function(msg,type){
		if(type == 'home' || type =='user'){
			msg.processedtext = msg.processedtext
			.replace(/>http:\/\/img.ly\/(.*?)</ig,'>http://img.ly/$1<img src="http://img.ly/show/large/$1"<');
		}
		return true;
	}
};

